﻿using System;
using System.Collections.Generic;
using System.Text;
using TntOrm.Attributes;

namespace TntOrm.Structures
{
    [Serializable]
    public class FieldMapping
    {
        private string _PropertyName;

        public string PropertyName
        {
            get { return _PropertyName; }
            set { _PropertyName = value; }
        }

        public string FieldName
        {
            get { return _FieldAttribute.FieldName; }
            set { _FieldAttribute.FieldName = value; }
        }

        private OrmReference _Reference;

        public OrmReference Reference
        {
            get { return _Reference; }
            set { _Reference = value; }
        }

        private bool _PrimaryKey;

        public bool PrimaryKey
        {
            get { return _PrimaryKey; }
            set { _PrimaryKey = value; }
        }

        private bool _LookUp;

        public bool LookUp
        {
            get { return _LookUp; }
            set { _LookUp = value; }
        }

        private OrmTableField _FieldAttribute;

        public OrmTableField FieldAttribute
        {
            get { return _FieldAttribute; }
            set { _FieldAttribute = value; }
        }

        public FieldMapping( OrmTableField Attribute, string Property, OrmReference ReferenceType
                             , bool IsPrimaryKey, bool IsLookUp  )
        {
            this._LookUp = IsLookUp;
            this._PrimaryKey = IsPrimaryKey;
            this._Reference = ReferenceType;
            this._PropertyName = Property;
            this._FieldAttribute = Attribute;
        }

        public FieldMapping( )
        { }
    }
}